home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / procssng / ccs / ccs-11tl.lha / lbl / xview / segal / region.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-24  |  1.4 KB  |  65 lines

  1. /*
  2.  *    region.c - for use with SEGAL 3d
  3.  *
  4.  *    By Bryan Skene
  5.  *
  6.  */
  7.  
  8. #include "common.h"
  9.  
  10. /**************************************/
  11. void
  12. traverse_region(roi, x, y, z, f)
  13. int roi;
  14. int x, y, z;
  15. void (*f)();
  16. {
  17. /* traverses the region specified by roi and feeds the coordinates to the
  18.  * funciton f().  Pass in initial values for x, y, z.  This func will vary
  19.  * the appropriate coordinates.  f() must take as arguments x, y, z.
  20.  */
  21.     set_watch_cursor();
  22.  
  23.     switch(roi) {
  24.     case R2d_WHOLE :
  25.         for(y = 0; y < win[WIN_PAINT].img_r; y++)
  26.         for(x = 0; x < win[WIN_PAINT].img_c; x++)
  27.             (*f)(x, y, z);
  28.         break;
  29.     case R2d_CROP :
  30.         for(y = region.y1; y < region.y2; y++)
  31.         for(x = region.x1; x < region.x2; x++)
  32.             (*f)(x, y, z);
  33.         break;
  34.     case R2d_PT_LIST :
  35.         for(y = 0; y < win[WIN_PAINT].img_r; y++)
  36.         for(x = 0; x < win[WIN_PAINT].img_c; x++)
  37.             if(BIT_IS_ON(win[WIN_PAINT].m_data[y][x], m[BUF_PTS].bit_key))
  38.                 (*f)(x, y, z);
  39.         break;
  40.     case R3d_WHOLE :
  41.         for(z = 0; z < segal.f; z++)
  42.         for(y = 0; y < segal.r; y++)
  43.         for(x = 0; x < segal.c; x++)
  44.             (*f)(x, y, z);
  45.         break;
  46.     case R3d_CUBE :
  47.         for(z = region.f1; z < region.f2; z++)
  48.         for(y = region.y1; y < region.y2; y++)
  49.         for(x = region.x1; x < region.x2; x++)
  50.             (*f)(x, y, z);
  51.         break;
  52.     case R3d_PT_LIST :
  53.         for(z = 0; z < segal.f; z++)
  54.         for(y = 0; y < segal.r; y++)
  55.         for(x = 0; x < segal.c; x++)
  56.             if(BIT_IS_ON(mbuf[z][y][x], m[MASK_ROI_3d].bit_key))
  57.                 (*f)(x, y, z);
  58.         break;
  59.     default :
  60.         break;
  61.     }
  62.  
  63.     unset_watch_cursor();
  64. }
  65.